package cn.xo68.metadata.service;

import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.xo68.metadata.entity.MetadataTable;
import cn.xo68.metadata.mapper.MetadataTableMapper;



/** 
 * MetadataTable Service
 * @author wuyy(16349023@qq.com)
 * @date 2020年03月12日 11:44:16
 *
 */
@Slf4j
@Service
public class MetadataTableService{
    
    @Autowired
    private MetadataTableMapper metadataTableMapper;

    public MetadataTable find(Integer tableId) {
        return  metadataTableMapper.find(tableId);
    }

    public MetadataTable insert(MetadataTable metadataTable) {
        metadataTableMapper.insert(metadataTable);
        return metadataTable;
    }

    public MetadataTable update(MetadataTable metadataTable) {
        metadataTableMapper.update(metadataTable);
        return metadataTable;
    }
    
    public int delete(Integer tableId) {
        return metadataTableMapper.delete(tableId);
    }
    
    public List<MetadataTable> list() {
        return metadataTableMapper.list();
    }
	
	public PageInfo<MetadataTable> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<MetadataTable> docs = metadataTableMapper.list();
        PageInfo<MetadataTable> pageInfo = new PageInfo<MetadataTable>(docs);
        return pageInfo;
    }
}